# !/usr/bin/python3
# coding: utf-8
from flask import Flask, request
import control
from control.port import check
from flask_cors import *

import datetime

app = Flask(__name__)
CORS(app, resources=r'/*')


@app.route('/')
def hello_world():
    return 'Hello World!'

@app.route('/student/<id>', methods = ['GET', 'POST'])
def check_student(id):
    return control.port.check(id)

@app.route('/accept/<id>', methods = ['GET'])
def accept_requst(id):
    return control.port.accept(id)

@app.route('/reject/<id>', methods = ['GET'])
def reject_requst(id):
    return control.port.reject(id)

@app.route('/students',methods = ['GET','POST'])
def check_all():
    return control.port.checkall()

@app.route('/search',methods = ['POST'])
def search_student():
    return control.port.search(request.json)

@app.route('/insert',methods = ['POST'])
def insert():
    return control.port.insert_info(request.json)

@app.route('/scholarship/', methods = ['GET'])
def scholarship_type():
    return control.port.scholarship()


if __name__ == '__main__':
    app.run()
